package com.doit.demo02;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

public class test_byte {
    public static void main(String[] args) throws IOException {
        OutputStream out = new FileOutputStream("d:\\work\\abc\\1.txt");
        //一次写入一个字节
        out.write(100);//d
        //通过字符组写入
        byte [] bytes = {97,98,99,100};
        out.write(bytes);
        //字符串转数组
        out.write("我嫩 跌".getBytes());
        out.write('\r'); //换行

        out.write("唐朝李白:静夜思".getBytes());
        out.write('\r');
        out.write('\r');
        out.write("床前明月光,疑是地上霜.".getBytes());
        out.write('\r');
        out.write('\r');
        out.write("举头望明月,低头思故乡.".getBytes());
        out.write('\r');
        out.write("               窝屎 \r  白日依山尽,黄河入海流 \r  欲穷千里目,更上一层楼".getBytes());


        out.close(); //如果不关闭的话,文件就不能删除
    }
}
